package com.cmos.um.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSONObject;
import com.cmos.um.iservice.IAcdSV;
import com.cmos.um.utils.Result;
import com.cmos.um.utils.ResultUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 分机相关接口
 */
@RestController
@RequestMapping("/zuc/acd")
public class AcdController {

    @Reference
    private IAcdSV iAcdSV;

    /**
     * 向所有cti新增分机
     * @param params
     * @return
     */
    @PostMapping
    public Result addAcd(@RequestBody JSONObject params){

        if (!params.containsKey("params")) {
            return ResultUtil.error("-9999", "入参不符合规范");
        }
        return iAcdSV.addAcd(params);
    }

    /**
     * 向所有删除分机
     * @param params
     * @return
     */
    @PostMapping("/telephoneNumber")
    public Result deleteAcd(@RequestBody JSONObject params){

        if (!params.containsKey("params")) {
            return ResultUtil.error("-9999", "入参不符合规范");
        }
        return iAcdSV.deleteAcd(params);
    }

}
